<?php

namespace App\Models;

class Attendance extends BaseModel
{
    protected $table = 'attendance';

    protected $fillable = ["school_id", 'campus_id', 'student_id', 'course_id', 'status', 'card_id', 'kx'];

    public function course(){
        return $this->belongsTo(Course::class);
    }

    public function studentCard(){
        return $this->belongsTo(StudentCard::class, 'card_id');
    }

    public function getSubjectNameAttribute()
    {
        return $this->course->subject['subject_name'];
    }

}
